<template>
  <div>
    <detail-banner :sightName="sightName" :bannerImg="bannerImg" :gallaryImgs="gallaryImgs"></detail-banner>
    <detail-header></detail-header>
    <div class="content">
      <detail-list :categoryList="categoryList"></detail-list>
    </div>
  </div>
</template>
<script>
import DetailBanner from './components/Banner'
import DetailHeader from './components/Header'
import DetailList from './components/List'
export default {
  name: 'detail',
  data () {
    return {
      sightName: '',
      bannerImg: '',
      gallaryImgs: [],
      categoryList: []
    }
  },
  components: {
    DetailBanner,
    DetailHeader,
    DetailList
  },
  methods: {
    getInfo () {
      this.$http
        .get('/api/detail.json', {
          params: {
            id: this.$route.params.id
          }
        })
        .then(res => {
          const data = res.data
          if (data.ret && data.data) {
            this.sightName = data.data.sightName
            this.bannerImg = data.data.bannerImg
            this.gallaryImgs = data.data.gallaryImgs
            this.categoryList = data.data.categoryList
          }
        })
    }
  },
  mounted () {
    this.getInfo()
  }
}
</script>
<style lang="stylus" scoped>
.content {
  height: 15rem;
}
</style>
